{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 积分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 符号积分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "积分与求导的关系：\n",
    "\n",
    "$$\\frac{d}{dx} F(x) = f(x)\n",
    "\\Rightarrow F(x) = \\int f(x) dx$$\n",
    "\n",
    "符号运算可以用 `sympy` 模块完成。\n",
    "\n",
    "先导入 `init_printing` 模块方便其显示："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sympy import init_printing\n",
    "init_printing()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from sympy import symbols, integrate\n",
    "import sympy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "产生 x 和 y 两个符号变量，并进行运算："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFYAAAAlCAYAAADY4B6YAAAABHNCSVQICAgIfAhkiAAAA4FJREFU\naIHt2UuIHFUUxvFfEskYoxFfmBiNY4JEGYzGiEqiaNABSVw4IrNQcZOVulBIFAV3IkRRwfiAgIsy\nii9ERfCBJMYEUUQFdaGoEB8Iig9E1BAFExenm+kuu0xN1e2Zsak/NN236ta5H7fOveec2zQ0/J+Y\nlcDGgQQ2Gnrw7HQLmInMrvn8cnyeQsigUXdi1+PlFEIaunlG/ZczkNSZlCPwB/Yn0jJQ1JnYUWxP\nJaRhgq04ZrpFzFTqeOzR+DmVkEGj6sSuxIcphQwah1R8LlWadR5W40iswZ3YncBuSqZU43MJbByO\nzR3tcezF4gS2UzGlGo8VgasuK0SqtqzVXiDOHcYT2E7FlGq8FlcmsDNLLLP2QdCIEL0yge1UTKnG\nTBQHqXkc9/XBbkpKa+yVFSzBnIL+c3AYfqumq5AN+A6batpZoXpAPhi1NB6K94X792INNlbTVcjl\nQnR7/OEatrKazxcxaY15j90oIt4lBf1Tn2ZdhONbNhfiMixKaD8FtTWehLOwDW8U9HmhpK1VeAD3\n43lRpd2Ou/GEiLJLxZZyIPdZMBnROTLlPXYYD4oJuzp370ZxDpJU43XYh3m56ydiS4nnl+JhE6sh\nE4fhq8VWsl/67aRNpvzEPoK5uAkf5+69i6frCOkVvHZgSExCJ+vwagmbm3CbiePE+fgFb+Mb4cVZ\nBa0puQBv4S+xtDv/BZmPs7GrHwN/qrvigCfFxn0wTsm1v8VdKUSVIFPOYxcK51mMvzHWcW9ULPeR\nOkKKUpPtugPYXOHd+0rY/LLj93IhfmcldcU8hjN7XF+Cc4Un5tmAD1q/v299j+N3vNLR70L8hE+S\nKM1xhXiTR7Xao7ihgp3r8afIfdssK+ibgszk0q3X8GLu2psi4Nai6Nhwp1gOa1vt9brfahHzcA/O\naLVHRWDY2zHeLZWU9oeT8VlHe0jk8LVPr4om9ldRKFzaag/jqxL21omJG8FpOFV4bJs7xDKeKXwt\nUsE2m0UcqR24/qv824GrxOR8UdLeLrEcV4nIer5Ia7aKfe8lvFNRaz+4GY/iIbGqzhFO9VE/B10r\ntoN7cXE/B0pIpnpJO1sEtW2pxBQxJN7iD/p3sJGaLSKVKsNTuguDMbGqTk8tqhevS/NvwUzkR1HS\nwgnYg2tSGS86HmyzCO/5d8k3COzBcaLyGsOtylWWDQ0NDQ3TzD+oDaLToDx6/gAAAABJRU5ErkJg\ngg==\n",
      "text/latex": [
       "$$\\sqrt{x^{2} + y^{2}}$$"
      ],
      "text/plain": [
       "   _________\n",
       "  ╱  2    2 \n",
       "╲╱  x  + y  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x, y = symbols('x y')\n",
    "sympy.sqrt(x ** 2 + y ** 2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对于生成的符号变量 `z`，我们将其中的 `x` 利用 `subs` 方法替换为 `3`："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEoAAAAlCAYAAADlcn/+AAAABHNCSVQICAgIfAhkiAAAA49JREFU\naIHt2WuoVFUUwPFfXvEmlqI9vGbqTYmIwDKiKIuSuiDZh4y4HzJKECIqSJDyY0RBEtkHiyCImAx6\nEdWH3mgvougFWVBkIAUFYS+kMrHMPqwzdGY65845c851Jps/XIZ99tlrr1mz9tprrcuAAXVyRA0y\nDtYg43/BU71W4FAwpeL6U7CzDkX6naqGWoUX6lDkcOdJ1Y39n6DKlzwav+GvmnTpa6oYagzb6lLk\ncOZBHNNrJQ4VVTxqDn6sS5F+p1tDLcPHdSrS70ztcl0dacE5OA+zsBx34K2KMvuOpyuuPwqbUuNx\n7MX8inL7imNFIK/CUpFWLEnGM0XNOF5R7qTRzdFbiVcq7vspzsWuZLwg+fyyotyiLMZt2IcDmIGN\n+K7OTRoi2ayTR7G5Zpl5nIQfcEXq2dXYoaTjLMRQztyQ+rsF63C36i2fpYp90efwk9Ybf7rwrrVF\nNzsSH4obKYvl2FBUWAEuE4Zq7j1aQVajwPpp+APvZ8x9gefzFrbnURvEzXNxzvt1dgsuxNxE3oiI\nffNqkp3HHOF1+zLm9uDsIkIW4AxsxWs57zxbQM4o7hMGuKpt7kZRHy7GL+KmS//NLKJoDg2dPWpI\nFPJZHvVNokPhOHWNsPj0tucnYkuB9Q8IF78Zn7TNvYcniipSkoZiR/dhEczTMXFEpCsHcXzWoqwS\nZjuGRTxKcyle6qDE+Xgb+8VRSnc/Z+BMvNlBxmSzUQTz65LxVNzkn5LsQBlhn2vNnOExEXAnYkQY\neX6y4erU3Jj4xU4ro0gJGopfBrNFHnUv7sQicYn9Luf2zTuP27QG9GnC+7KCYJpmwjaOX/Fiau4C\n4fKfdZDRiUdwesbzhSIY78+YW4ePUuOfcXvbO3PxjpL/VbpceMTsZDyGG0qsf1nkK2newDNllChJ\nQ/fpxXHCQNfnvZDXZnk9WbgiGa/S6h2dWCTykibDIjfrh+7AeuwWl1OTa/GtMHYmeYbaI87sJcl4\nFF+VUOZrkbM02STiW68DOdG52Is/k/Ey3CLCRW5omShn2I4rcbLyxep6PIT7E6XOEsbfUVLOZLBZ\n9MDuEjXrLBFq3u1W4Apx/O7BRRUUmyKC/NYKMorQUK0E6pph4Q27lauqH9eaaK4WN9Gp9amWyRaR\nnvSEV5XvZn4vShg4QfSc1tSpVC/Ia6c0mYcP/LsUmYhd4rpdKbzpVp0z+gEDBgwYUIG/Aayknkb9\n3TKcAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$\\sqrt{y^{2} + 9}$$"
      ],
      "text/plain": [
       "   ________\n",
       "  ╱  2     \n",
       "╲╱  y  + 9 "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "z = sympy.sqrt(x ** 2 + y ** 2)\n",
    "z.subs(x, 3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "再替换 `y`："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAsAAAASCAYAAACNdSR1AAAABHNCSVQICAgIfAhkiAAAAMxJREFU\nKJHN0TFLQmEUBuDHFIKGFhVcmvwFDW35T/wHQXOLo3/AsSVozTlwCwcbGhoaxHLJTVAIAo0cbLjf\nhevHTW5bL5zh/d5zXt7vHP6AcsQn+MAyaOe4xhMW8fA2qm9cpGIlap5hgDrecIPxb7Ee9mU+2CfG\nKEX8EfeoYoMmrvCaNzzFSYa3MUejSKwyVugVjfoeamd1Q8kfWjnutdjhE885zl+Sy+7gTrKFLE4l\nl+zEzWfo4yjwEm4xwmH6kEULl1jjGC/ohij/BT8UwSaNbxctpgAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$5$$"
      ],
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "z.subs(x, 3).subs(y, 4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "还可以从 `sympy.abc` 中导入现成的符号变量："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADgAAAAXCAYAAABefIz9AAAABHNCSVQICAgIfAhkiAAAAwFJREFU\nWIXt1luIV1UUBvCf5jRTpqNEmdeGSaickHoIqYx8CZoIwiAhUCh96KVMnHqIsIjCSzREQw9JEIE+\n2IUukJQPGjVRQSlRURFCklFZ2kOF0lDaw9qH/57tmWb+MzqCzAebc9Z31t57rX1Z3+Esx6RxnGsJ\nrkc7bsAT+GAc5z+tuACbM3sFjmLumQnn1GMxjuOyZE/HCZHoWYFJ4ohWV6JLJHjNGYuowDL8jvWn\naLxt6B3GpwUdQ3zrwFZswWuYhlmYOdqA7hIrvnW0A2RYg6f8f4Gbgsdwfs23DuzD7GT3oA+TsWmI\nPiPCwjTxWHCbSBDaDL1DPeLeljgXe7E64+7ED+l9Np7OO0xuIrj9+KcJ/xI3iWO0E5fgFo1dyDFN\nyMkXNd8eSH22Z1w75osj/bOo2AuaCawVl2Mprm6mY4ZO/CmOed6m1/jegQdr+DYcFvqZozeN1Zrs\nFXioLojl4m48jMfxXGpXYVca5KXC/8s06QbcjI14Fh/hutpUh0ef2O0Sd6cYugr+E/yR2Z14q+x8\nJfYU3EqDE/qssOFCsTM7Ne5WFeSBmiBHgtednAQR9DG8m7Xd+Bf9mV+7WHg07uBiXCzOf4U38Vdm\n5+8VjqTWiRcz/itciouGy6YGU/F3wZ0jdvUNcXer1ptyeC/zPSqKERoJ9osEfxQadT/Ow30jDOpz\ncXwqDGTBNovfnKxnc8XOfFzw3en5asbNxK+VUSX4k/jT2CFEvQ8Hhf6NBOWKjwXfYl7BzUrPrzNu\niigo/bIjKSrqN5VRJXitEN57k8MCvCyEvdX44h3cWHCVPP2Scd3i1G0ofJeKmoBGgl0G79ZBIabH\nMWNs8TaNvULrWjKuEvJch3vwAt4v+i8Ri4TBQr8OczJ7Hr7DoWS3qP+TqeNbimezeAarMvuIkJ4r\nkr1anKy1Rb9bRSEaKHgr8UgaeCOeFBo4X1SvT0URGRByMhW3i9Wu+A/Fyr8ifsxP4Hs8Osoku7Eo\nsxfhbTwvakRb4T8H94xyrglMYAKnCf8B3eKPw+iETXAAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$\\sin^{2}{\\left (\\theta \\right )}$$"
      ],
      "text/plain": [
       "   2   \n",
       "sin (θ)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sympy.abc import theta\n",
    "y = sympy.sin(theta) ** 2\n",
    "y"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对 y 进行积分："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJ0AAAAZCAYAAAArBywYAAAABHNCSVQICAgIfAhkiAAABZBJREFU\naIHt2nusXFUVx/FPoaWVlhQCCC0CV3ILVAIWGorWIqUJJkAaAgQrj5iC4h+mhEdjMEExQVM1iqaF\n8FCI4gMaFAIpFYRAqqVAoCUkGh5/+QAJCqEEDEjB1j/Wmdx9991z55w7U4fqfJPJzFmzH7+91tmP\ns2YYMGAX5qx+CxjQF/oW9yNxT786H9A3JhT33drYh3AzvotfY68O7ZyHOzLbAtyN+/EH3IqDmgrs\ngsV4HVf0oK0pwic5Q8p+OgD79KDfbmmnm7L2prp7FvchPI1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mzgvTU3sG7TfXnP7cjHeocQ2Hz9Irpv66VKcUX3+dFXuykK5XMN5\nhe++Wn23WOfx57qbak91p/Qk7q2VrpUYTGfYSvwYvys0erY4rI7HhdiOb2b2RR3q1eEoo1e1F0Wy\nc7uRbHgv2CKedFv5q6Z+OkFsRfCYWOWWFMqdVfWzDm+LdE/O/Kr+ozqPP9fdVHuqO6Xncd9k5O6+\nSGx709o0/CAOHafjJeJA/IvstdbY3+omwnJxbpmd2A41dhZuqvrN+VvBfrGY9XMy+wKjs/d1/XSa\nyPSnnCLSJOkqsj9uTK7PFzfXrMT2UeHPk6vr5TqPP9ddV3tJd4uex/1juE+cm9YUxLQ4UHlWp2wV\nASy98hkwES7AVeLJb5VYzq8X2wyxXTxV9bdNpBemC4dvSeyPiuDeKf4csEMkOK/O+jtV+Id6fpot\nZnyJBfiNOGRfW+mfmZU5sfr+BlwnkrlHNxh/SXcd7ePp7mvcL8OXu2lgwC5JX+O+Cfv1q/MBfaNn\ncW/3f7p2DIsE4670o/2A7ulp3JvedKU/7Q3436evcV8nfm4Z8P/FIO4DBgwYMGDAB5v/ACgJsG1Y\n9yxvAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$\\frac{\\theta}{2} - \\frac{1}{2} \\sin{\\left (\\theta \\right )} \\cos{\\left (\\theta \\right )}$$"
      ],
      "text/plain": [
       "θ   sin(θ)⋅cos(θ)\n",
       "─ - ─────────────\n",
       "2         2      "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Y = integrate(y)\n",
    "Y"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "计算 $Y(\\pi) - Y(0)$："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJMAAAASCAYAAABfCexoAAAABHNCSVQICAgIfAhkiAAABchJREFU\naIHt2W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2VjhKOFOFUs3URt4kjGrvTPWF\n3F149M0FXjhJObQvUTaIKFrHxY7oVR6xezaKVp7YSdfjmSRvf+Gg46KoHK7dv1n32mCGSFVPCedo\nwkJRR12f0frVO1V7iXf2U50dcmnte5LXy07qFTtq4+0iRJ7ewH+xWPw6xrromJ1+3ynMNcmrZC4R\nu+n7YrFuF8+8VXQqbybeV8QZTo7Notie1SB/m4hQS8Q5UAmzcK/omL6V0fvVO1V7CecYFcV/N/Qq\nr4hR7SLTevyuQN+clNUxU+zQGwpzs9ND/rAw97johNrI64a/4dfZ+HVlO34r1uPDafxRkw909048\nO0TNk2NIONJ3Gp6jV70VBmHvCH5U4GnKCjuTN7DItMjkBSRC/qYC/RjhNG8U5raIonNuYW4hnmsp\nrwkHihPpNRmtKU1VBf+YcJpnRYhfkPFsT79DIsXnWCFqomsz2rkt9eYYhL1fEJtibXatS3Nnp/FS\nzSitXxGjukemI3Tm9zUm8nCF6nDumsL956W5iwpzxA5+VWfBtyDdUz9V70XeZWL3H5rRLheRM+9S\nzhF1Xm7bEP6Jn6fxnqJb/bM4SK2wOD1D3lnBl5Uj0uqWenMMyt465ilHpp7kNUWmimGvwtyJ4rBq\nbUZbiZ9k/EP4Gp5Mc3VU1X9Trl4ldl7+OeUSUXDe3oe8OeJlVe3rIvGd70ydafgB0drnDvtF4TxX\npvFWfE80FnnKvVSknvwFfz7xHo57sut+cWTQRm+OQdlbx8zab9/yDhKHgi+a+NYzJj7cfinjO1K0\n/D+u3f9ZEaF+JhxtheZdcIbYdYsbzYqWdZ34dHEHHlJOfb3IGxYv9S48KDqvzzTw7ici8xpR59yn\nM51VOD/N3Z3kPSA+1OZ4S/N3tBV96mWw9hKp+wn83URn+WTS04+8aUxjGtOYxjQ+aPgf1hMJbOhz\nlqIAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$1.5707963267949$$"
      ],
      "text/plain": [
       "1.57079632679490"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "np.set_printoptions(precision=3)\n",
    "\n",
    "Y.subs(theta, np.pi) - Y.subs(theta, 0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "计算 $\\int_0^\\pi y d\\theta$ ："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAACEAAAAZCAYAAAC/zUevAAAABHNCSVQICAgIfAhkiAAAAc5JREFU\nSInt1k2IjlEUB/DfMOWzMQtponzUu5gtZVZYCCVlYTaMmrKwsdDEUlamLJSyYEXKR5RCDRELUT6i\nkFnZDQtJioWJmfKxOM+bd67rfXg9Q03+9dS5/+fcc//3nOee5zJFseVfC+jG5d+dNK1iEX04l3A9\nuIhrGMYJLKp43Ql4jFkN4xW4gc5iPBd38AZLJ0NAD04n3FXUEm45vuL8ZIg4go0J9wEvsSDh3+Ft\n1QKm4xnaE34YY1iW8K8xmgvUIVL0UaQr93zB6szc9Tia4eegK+EWFrFu1Ym68jacwhOcFGf9EUYw\ngGMYxyfcyyzWh+MZftSPO95dbGZf6txvYj0viBTDUCZ4I2biabGRMtTEdzJY5tiJS4U9Gw9K/Htx\n8BcEzMBDHE5f5JrVdtwv7G58Lgm+DWdLfNpEma9jT4kvIrUrC3sTnjfxnSd2V4ZB7E+4/rqRZmIN\nlojOR5yYxaLuOfSKltwMO8SHeCDhV9WN9FzvxU3fS/CqELAOVzILbMXOJgLW4pAow5kGvl0c0yxG\nsKFh3IEX2Jzx7cLtJgKIzviznpNmpiUMYFcVgf4EdzG/ikCt3idqeK+in1CrInKXl7+OIXFB+Y+p\nh284OVxxrb4HkAAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$\\frac{\\pi}{2}$$"
      ],
      "text/plain": [
       "π\n",
       "─\n",
       "2"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "integrate(y, (theta, 0, sympy.pi))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "显示的是字符表达式，查看具体数值可以使用 `evalf()` 方法，或者传入 `numpy.pi`，而不是 `sympy.pi` ："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJMAAAASCAYAAABfCexoAAAABHNCSVQICAgIfAhkiAAABchJREFU\naIHt2WuMXVUVB/DfQEsZWoHwHAkNLS3iI1FKKkVAYkRISEggTeQRG0C+CBgCRh5KBIsFITXRiGCx\nEBiF8LAEmkAT1AhaPwA18hAioZKYajHIEFCgUrTt+GHt4+x7Zp/be+7cfiHzT07u3Wuvs9ZZ+6y9\nHvswjWkMCEMN9L3wFD7ZQtbLWIEnsAWL8Q1cgpcSz6m4Dc/jPbyPHZmM3+PW9P9I3IhNGMcBuAL/\nyPjbyDsc38ZWbMdsXIXXCrZ8BMszme+l8TsZz7H4SpobFmv23fQsOY5J6zCMQ7EB1+LVPvTuKntz\nXI6ZYu1z9CXv0+mhxneitI7x2vUffLXG8/UCX36dmvj2wWYsy+69Gi9ijz7kzccbWJrdu0y8lBm1\nZ/w4/orj0ngEfxEvtcIiPIo9M9oqvI2jMtrR+CX2TeM5WI/XMa8PvbvC3hyHiUCwvEZvLe9jWIdR\nEZXaOtMmrMbDWJnk1bEKc4Xn75bRj8ct2fgGseD5g+6H/+KiPuStxZs1nmGxy87PaDNEhL0so83F\nGC7NaD8Q63NWRjst0W7OaOuwUCcWJb77+9A7aHvrWJ2ebXmN3q88hEO1dabf9MBzS4E2B4+JNFFh\nIx4p8L6Ax1vK20M44YYC78siwlS4QETUfQu8Oc7Fv3ByRjtbrNlNGe1dEW0Oqt3/ltjpbfUO2t4c\nS03YsDyj9yvv/xi1a5yphFVYko0/lHTfWuD9hXiJbeSNJHnrC7wbRASs8Cv8aSfym7AS2/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NYzJj7cfinjO1K0\n/D+u3f9ZEaF+JhxtheZdcIbYdYsbzYqWdZ34dHEHHlJOfb3IGxYv9S48KDqvzzTw7ici8xpR59yn\nM51VOD/N3Z3kPSA+1OZ4S/N3tBV96mWw9hKp+wn83URn+WTS04+8aUxjGtOYxjQ+aPgf1hMJbOhz\nlqIAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$1.5707963267949$$"
      ],
      "text/plain": [
       "1.57079632679490"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "integrate(y, (theta, 0, sympy.pi)).evalf()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJMAAAASCAYAAABfCexoAAAABHNCSVQICAgIfAhkiAAABchJREFU\naIHt2WuMXVUVB/DfQEsZWoHwHAkNLS3iI1FKKkVAYkRISEggTeQRG0C+CBgCRh5KBIsFITXRiGCx\nEBiF8LAEmkAT1AhaPwA18hAioZKYajHIEFCgUrTt+GHt4+x7Zp/be+7cfiHzT07u3Wuvs9ZZ+6y9\nHvswjWkMCEMN9L3wFD7ZQtbLWIEnsAWL8Q1cgpcSz6m4Dc/jPbyPHZmM3+PW9P9I3IhNGMcBuAL/\nyPjbyDsc38ZWbMdsXIXXCrZ8BMszme+l8TsZz7H4SpobFmv23fQsOY5J6zCMQ7EB1+LVPvTuKntz\nXI6ZYu1z9CXv0+mhxneitI7x2vUffLXG8/UCX36dmvj2wWYsy+69Gi9ijz7kzccbWJrdu0y8lBm1\nZ/w4/orj0ngEfxEvtcIiPIo9M9oqvI2jMtrR+CX2TeM5WI/XMa8PvbvC3hyHiUCwvEZvLe9jWIdR\nEZXaOtMmrMbDWJnk1bEKc4Xn75bRj8ct2fgGseD5g+6H/+KiPuStxZs1nmGxy87PaDNEhL0so83F\nGC7NaD8Q63NWRjst0W7OaOuwUCcWJb77+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M4SK2wOD1D3lnBl5Uj0uqWenMMyt465ilHpp7kNUWmimGvwtyJ4rBq\nbUZbiZ9k/EP4Gp5Mc3VU1X9Trl4ldl7+OeUSUXDe3oe8OeJlVe3rIvGd70ydafgB0drnDvtF4TxX\npvFWfE80FnnKvVSknvwFfz7xHo57sut+cWTQRm+OQdlbx8zab9/yDhKHgi+a+NYzJj7cfinjO1K0\n/D+u3f9ZEaF+JhxtheZdcIbYdYsbzYqWdZ34dHEHHlJOfb3IGxYv9S48KDqvzzTw7ici8xpR59yn\nM51VOD/N3Z3kPSA+1OZ4S/N3tBV96mWw9hKp+wn83URn+WTS04+8aUxjGtOYxjQ+aPgf1hMJbOhz\nlqIAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$$1.5707963267949$$"
      ],
      "text/plain": [
       "1.57079632679490"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "integrate(y, (theta, 0, np.pi))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "根据牛顿莱布尼兹公式，这两个数值应该相等。\n",
    "\n",
    "产生不定积分对象："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAF8AAAAxCAYAAAC8snXfAAAABHNCSVQICAgIfAhkiAAABXZJREFU\neJztm2tsVEUUx3+1LaW20OJbaLGRh1qjSHw0sShtPxAhRqOJjcQX2kS/IBirn4ya4AsfQGjUSPzg\nE1MVNSS+FalSRbQYYsVX8REh8QVobERbEPzwn5udvd3unXt3t5vN3l/S3Duzc+ecPXtm5pyZW4gp\naJYAe4HPgJPyrEtR0QocAM4FBoDe/KpTXHwCvA5UAt8B3flVp3hoAg4B1+RbkWLkYWT8Y/OtSDHy\nE7A930oUModFfG4GUE+8wGZEVOO3meuWbClSjEQ1fqu5bs2WIjHu/Az8C5TnW5FiYyaKcvryrUih\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tRFOXFzl4SY+cZ\nncDjjIzFm9CPF8Rfvr5BM8Fcq8+lYeW7Gt+b770z25uAydbndcC3JPZ8ykkdxqaqL/ddo7AKuMrc\n7wE+QlMlyDEqGLkFvgB4hcSak44BlMQ1WLo+avrdgbza++6u8p3ZhRbJRSisvA194XuBu1GkU488\n4VPTdhiFpFXAxchDvfpe5K0voE04L4q6I6qCaGg3mvtG4FWUd3ShXMRmMnBtyP5noilqlelzBrLH\nRuTVR1htg+Q7U0siyzwlaicx0WhGht9D8O5iTAhc5nwve+wlOT6PyZAwxo8PsLOMi/G9MDN+NTAP\n7AX+Jn5Basw5Ac3z/l3MmCwQNO2caa4bc61IMRJk/HPMdUOuFYkZSQ/a18j0MDwmJJXoNMZ/RBeT\nJdJNO21oT2L9GOlS1KxGO3fjTHktOiDP1otFMWnYjv6XthLtUA6R2S5jTACl1v1s9EpHP3rtYxi4\nGh2TxeSYo9D57D70X+V16ZvHxMTExBQY/wOjDi/8nWy6FQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$$\\int \\sin^{2}{\\left (\\theta \\right )}\\, d\\theta$$"
      ],
      "text/plain": [
       "⌠           \n",
       "⎮    2      \n",
       "⎮ sin (θ) dθ\n",
       "⌡           "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Y_indef = sympy.Integral(y)\n",
    "Y_indef"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'sympy.integrals.integrals.Integral'>\n"
     ]
    }
   ],
   "source": [
    "print type(Y_indef)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "定积分："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHIAAAA4CAYAAAAh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epQpEQSx1agi8sjIqOMHiPFftJZTdn4gyUe+nlMDn8MsiRO3H+q8cf1I9L\ntkQPgiMh4gzkFvRDGEspyufcmReNHI1GKcpHtb86sil8jgQpiXHNCZTbegfKih6FMuEOZLrI4XA4\nHA6HIwn+B7jjVvTlLJflAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$$\\int_{0}^{\\pi} \\sin^{2}{\\left (\\theta \\right )}\\, d\\theta$$"
      ],
      "text/plain": [
       "π           \n",
       "⌠           \n",
       "⎮    2      \n",
       "⎮ sin (θ) dθ\n",
       "⌡           \n",
       "0           "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Y_def = sympy.Integral(y, (theta, 0, sympy.pi))\n",
    "Y_def"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "产生函数 $Y(x) = \\int_0^x sin^2(\\theta) d\\theta$，并将其向量化："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "Y_raw = lambda x: integrate(y, (theta, 0, x))\n",
    "Y = np.vectorize(Y_raw)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAEVCAYAAAD91W7rAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xm4U+W1x/HvYlBUFFQUFVDqgMOtKFARxdagSAEtVkUF\nZ7FXbatWqx2w3Epbr1VbxaF1QrAgjq0IDogWL1FBZZBBEFGEqjgAUsSCiAJn3T/egDEcTpJzkrOz\nk9/nefKcDG92Fvs5rLxn7Xcwd0dEROKrQdQBiIhI3SiRi4jEnBK5iEjMKZGLiMScErmISMwpkYuI\nxJwSuYhIzCmRi4jEXKOoAxApBjNrBiSBVcBxwM7AgcCxwFJgn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eTLzHYDdnP3WWbWFHgN+GFczj+AmW3r\n7mvMrBEwCbjK3SdFHVeuzOznQCdge3fvE3U8+TKzfwGd3H1F1LHky8xGAC+4+/DU78927v5Z1HHl\ny8waEPJWE/2+AAACU0lEQVRnZ3dfXF2bYvfIc5lQVLLc/SXg06jjqC13X+Lus1L3VwNvAntEG1V+\n3H1N6u5WhOs0sUkoZtYa6A3cy+ZDdOMkdrGbWTPgu+4+HML1vjgm8ZTuwMItJXEofiKvbrJQqyJ/\nplQjNfKoAzAl2kjyY2YNzGwWYYLZRHefF3VMeRgC/AKoijqQOnBggplNN7P/jjqYPHwL+MTM7jOz\nGWY21My2jTqoWuoHPFhTg2Incl1JLQGpsso/gJ+leuax4e5V7n4oYbbw98wsEXFIOTGzE4Bl7j6T\nGPZo03R19w5AL+CnqXJjHDQCOgJ3uHtHwoi6X0cbUv7MbCvgB8Dfa2pX7ET+IdAm7XEbQq9c6omZ\nNQYeA0a5+5io46mt1J/FTwNx2Q7kSKBPqsb8EHCMmY2MOKa8ufvHqZ+fAI8TyqVx8AHwgbtPSz3+\nByGxx00v4LXU+d+iYifyTROKUt8spxMmEEk9MDMDhgHz3P2WqOPJl5m1MLPmqfvbAMcBM6ONKjfu\nfrW7t3H3bxH+NP4/dz8n6rjyYWbbmtn2qfvbAT2AWIzgcvclwGIza5d6qjvwRoQh1VZ/QkegRkXd\nWGJLE4qK+ZmFZGYPAUcDO5vZYuC37n5fxGHloytwFvC6mW1MgAPdfXyEMeVjd2BE6qp9A+B+d38+\n4phqK45lxpbA46E/QCPgAXd/LtqQ8nIp8ECqE7mQmE1WTH15dgeyXpvQhCARkZgr+z07RUTKnRK5\niEjMKZGLiMScErmISMwpkYuIxJwSuYhIzCmRi4jEnBK5iEjM/T8bTzxBOTN6TgAAAABJRU5ErkJg\ngg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xb8bd320>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "x = np.linspace(0, 2 * np.pi)\n",
    "p = plt.plot(x, Y(x))\n",
    "t = plt.title(r'$Y(x) = \\int_0^x sin^2(\\theta) d\\theta$')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数值积分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "数值积分：\n",
    "\n",
    "$$F(x) = \\lim_{n \\rightarrow \\infty} \\sum_{i=0}^{n-1} f(x_i)(x_{i+1}-x_i) \n",
    "\\Rightarrow F(x) = \\int_{x_0}^{x_n} f(x) dx$$\n",
    "\n",
    "导入贝塞尔函数："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from scipy.special import jv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "def f(x):\n",
    "    return jv(2.5, x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEACAYAAABfxaZOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmczXX///HHy1K2EqlMsu+T0W9sKWFs0UxX8lOWyKip\nK1kGaZkuhK6ISiHL2AalqMs6XBVizkiLRk0MMxiFLFGSNNbB+/vHDM3FDDPnzJz3WV73283t9vmc\n8zmf99O51cv7vD+fz/stxhiUUkr5h0K2AyillHIfLfpKKeVHtOgrpZQf0aKvlFJ+RIu+Ukr5ES36\nSinlR1wu+iLSQUS2i0iqiLyUzfshIvKniCRm/hnmaptKKaWcU8SVD4tIYWAy0BY4ACSISKwxJuWy\nQ+ONMQ+50pZSSinXudrTbwLsMsbsMcakAwuBjtkcJy62o5RSKh+4WvQrAPuy7O/Pf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/Roq+U\nUn7k/wDY8//eOSbGSgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xbfe3a58>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(0, 10)\n",
    "p = plt.plot(x, f(x), 'k-')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### `quad` 函数"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Quadrature 积分的原理参见：\n",
    "\n",
    "http://en.wikipedia.org/wiki/Numerical_integration#Quadrature_rules_based_on_interpolating_functions\n",
    "\n",
    "quad 返回一个 (积分值，误差) 组成的元组："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from scipy.integrate import quad\n",
    "interval = [0, 6.5]\n",
    "value, max_err = quad(f, *interval)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "积分值："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.28474297234\n"
     ]
    }
   ],
   "source": [
    "print value"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "最大误差："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.34181853668e-09\n"
     ]
    }
   ],
   "source": [
    "print max_err"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "积分区间图示，蓝色为正，红色为负："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "integral = 1.284742972\n",
      "upper bound on error: 2.34e-09\n"
     ]
    },
    {
     "data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Y0wcsaJvjDFxxIq+McbEESv6xhgT\nR6zoG2NMHLGib4wxceT/AZhppPNX9o1QAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xc126860>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "print \"integral = {:.9f}\".format(value)\n",
    "print \"upper bound on error: {:.2e}\".format(max_err)\n",
    "x = np.linspace(0, 10, 100)\n",
    "p = plt.plot(x, f(x), 'k-')\n",
    "x = np.linspace(0, 6.5, 45)\n",
    "p = plt.fill_between(x, f(x), where=f(x)>0, color=\"blue\")\n",
    "p = plt.fill_between(x, f(x), where=f(x)<0, color=\"red\", interpolate=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 积分到无穷"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from numpy import inf\n",
    "interval = [0., inf]\n",
    "\n",
    "def g(x):\n",
    "    return np.exp(-x ** 1/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "upper bound on error: 7.2e-11\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAlQAAADICAYAAAAuo384AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VNX9//HX504ISYAkhLAIYScgEBBQFsWFXahVwaWi\n8KX2URXrUtf+FLWKfrVKq9alrV8rgnX51gXrF4oKohBRwAqigIAQEWQTFNkNCpl7fn/MEBK2JDDJ\nzSTv5+NxHzP3zpl7P3EehnfOOXOuOecQERERkWPnBV2AiIiISLxToBIRERE5TgpUIiIiIsdJgUpE\nRETkOClQiYiIiBwnBSoRERGR41RioDKzCWa22cyWHKXNE2aWZ2aLzKxrbEsUERERqdxK00M1ER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CREfoVkZ2czffr0IMsWEQlUFZ5DVZxzbxAO\nt6Fjx85s37496HJEKq1x48bx61//GoD69evTokUL1q07cAeqRYsWccstt3DZZZexadMmAL777rvC\ncCUiUh1VkyG//fbieW2oW/cn1q5dTUpKSsD1iFQuq1atIjs7m48//phTTjml8Pibb77JN998w/bt\n2+ncuTODBg3inXfe4ZFHHqFNmza0bt2am2++OcDKRURiS3OoSpSP57WiUaNEVq/+ksTExKALEqk0\nnnjiCe666y527NiBWal/j4iIVDlah6pEKfj+F2zatJsTT8yhoKAg6IJEKo3c3Fx69uypMCUiUkbV\nMFABpOP7y/j660106XIyvu8HXZBIpfDhhx8WG+oTEZHSqaaBCqARvr+EZcvyOPXU04MuRiRwK1eu\nZMuWLXTp0iXoUkq0ZcsWxo8fz1//+tegSxERAap1oAJojnOfMn/+Qvr3HxR0MSKBmjt3LgAnnXRS\nwJWULDMzk+zsbA3Zi0ilUc0DFUA7nPuIWbNyGTbswqCLEQnM3LlzSUpKom3btkGXElMLFy4MugQR\nqQYUqADognOzmDx5MqNGXR50MSKBmDdvHu3atcPzqtavhXfeeafw+YQJE3j22WcZNmwYixYtCrAq\nEalqtBJfod449zYvvDCYOnXq8Ne/Phl0QSIVZteuXSxbtozhw4cHXUqplWbJl82bN9OoUSMA3n77\nbbp3706nTp3IzMxk1KhRClUiEjNV60/R4zYQeJW//e1vjBlzR9DFiFSYBQsW4Jyjffv2QZdSKlu3\nbmXq1KnMmTOH1atXH7HdlClTGDZsGAB5eXk8/fTTALRp04Y1a9ZURKkiUk2oh+oQFwITeeihy0lN\nTWXMmNuDLkik3H388ccAnHjiiQFXUtzrr7+OmbFw4UJycnJ45513mDBhAhkZGTz88MMlvn/r1q2k\npaUBcM0117B7924A5syZw5AhQ8q19uMxadIkXnzxRRYuXMiWLVto1qwZF1xwAXfccQe1a9cu8f3r\n1q3jpptu4t1338U5x4ABA3jsscdo2rRpBVQvUj2ph+qwRgF/4Y477uDBBx8KuhiRcjd//nwAOnbs\nGH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m3nrrLWrVqsWqVavK/f57zjnC4fAxDV/Onz+fSy+9lLlz59Kg\nQQMmTJiA7/vFeruefPJJrr/+epKTkxk6dChPP/00EyZM4L777mP06NHFAlVBQQHXXHMN+/btK/Ha\nw4cPLxzaLGr37t2cf/75JCYmMnHixDL/TCJSMRSoyqQ7zi1kzpxT6NatBwsXfqxQJXFv8eLFmBld\nu3aN+bl/9atf0bt3b1566SV27dpFw4YN+dOf/hTz6xS1cOFCTj/92G54fsUVV3DVVVfRoEEDINLb\nU3S4zzlH7969SU5OBiK9b48++igJCQns2LHjkPMlJCTw97///ZhqgUhv2LnnnsuaNWt4//33ady4\ncYnvqVu37mF7orZu3UpGRsYx1yIiR2clfQXXzAYDjwEhYLxzbtxh2vQB/gzUALY45/ocpo2Dklc2\njg+r8bxOtGrVlKVLF5GYmBh0QSLHZN++fdSqVYu0tDS+++67mJ575cqVnHjiiWzatKkwoFRmCxYs\noEePHixfvpx27doBcM455zBkyBCuu+66Q9pv2LCBli1bsm3bNmrVqhXzevbt28fQoUP58MMPmTFj\nBj169CjV+/r378/evXv54IMPih3v06cPZsasWbNiXqtIVWRmOOestO2P2kNlZiHgL8AAYAMw38ym\nOOeWF2mTDvwVONs5t97MMo+t9HjSEt9fyVdfdaRVq7asXLmMlJSUoIsSKbMVK1ZQUFDAySefHPNz\nb9++HeCQMLV69WpatmwZ8+sdr1WrVpGWllYYpgoKCvjwww8ZN24cH374YWGvl+/7eJ7He++9x8kn\nn1wYpubMmUPv3r2LnXPfvn1ce+21ZR7y832fESNGkJuby9SpU0sdpgDOO+88br311mL/ndesWcPc\nuXMZN+6Qv4dFJFacc0fcgFOBaUX2bwduP6jNNcB9RztPtJ0DV8W2753nNXCZmY3ctm3bnEi8efXV\nV52ZuTFjxsT83Hv27HH169d3eXl5hccWLFjgxo0bF/NrxcKSJUtcvXr1Cvcfe+wxV6tWLeecc3/4\nwx+cc8699tprrmHDhs4554YNG+ZGjRrlnHNu165d7o9//GPMarn66qudmbm77rrLz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yMioz8yZM4MuSkREpMo5aqAysxDwF2Aw0AG41MwO\nWUUy2m4cMA0odfeYVJRf4vvb2LnzVPr3H8CgQUPIz88PuigREZEqo6Qeqh7Al865Nc65fcDLwPmH\naXc9MAn4Lsb1Scwk4dxUIJf33ltA3br1tMSCiIhIjJQUqJoA64rsr48eK2RmTYiErKeihzTzvFI7\nE9/fzN69V3DFFVfRoUNnVq1aFXRRIiIicS2hhNdLE44eA253zjkzM4465De2yPM+0U0qngc8CdzI\nihXnk52dzdChF/Dii8+TkpISdHEiIiIVLjc3l9zc3GN+/1GXTTCzXsBY59zg6P4YwHfOjSvS5isO\nhKhMIB+40jk35aBzadmESusNPO8KPG83v//9ndx9991BFyQiIhKosi6bUFKgSgBWAP2BjcDHwKXO\nueVHaD8R+Ldz7l+HeU2BqlLzgfsw+wNpaak899yznH/+4abLiYiIVH0xXYfKOVcAXAdMB5YBrzjn\nlpvZaDMbfXylSuXiAWNxbivbt5/J0KHDaN++EytWrAi6MBERkUpPK6XLEeTheRfi+59z7rnn8b//\n+yK1a9cOuigREZEKoZXSJUay8f3FwP/x1ltzSU/P4M4779Rq6yIiIoehQCUlOI9w+FvC4bt48MGH\nSU2ty+OPPx50USIiIpWKhvykDH4ErsfsOVJTU3n44XFcccUVQRclIiIScxryk3KUBDyDczvYseMc\nrrrqaurVa8hLL70UdGEiIiKBUqCSY5ACPI9zW9i69QxGjhxFw4ZNeOONN4IuTEREJBAKVHIc0onc\nwnEz333XlQsuuJCsrBZMnz496MJEREQqlAKVxEBm9MbL69m4MZvBg4fQsmU2s2fPDrowERGRCqFA\nJTHUGOdmAKv5+usTOOusPjRt2oJXX3016MJERETKlQKVlIPmODcbWMOGDR245JJLqVs3k0cffVTr\nWImISJWkZROkAuwkstzCP6lZM5HrrvsNDzzwAImJiUEXJiIiclgxvTlyLClQCewFfo/n/RWzvQwf\nPpy//OUJ0tPTgy5MRESkGK1DJZVYIjAO399JOPwnXn55GhkZ9Rg0aDBr164NujgREZFjpkAlA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j4cj3wUvSP0VVo0eS44ZxbFO0NXkBk\n/uJC4O/BViVHY2b/BM4CMs1sHXA38BDwqpn9GlgD/OKo59DCniIiIiLHp9wX9hQRERGp6hSoRERE\nRI6TApWIiIjIcVKgEhERETlOClQiIiIix0mBSkREROQ4KVCJiIiIHKf/D3hzxzX6sL0TAAAAAElF\nTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xc260dd8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "value, max_err = quad(g, *interval)\n",
    "x = np.linspace(0, 10, 50)\n",
    "fig = plt.figure(figsize=(10,3))\n",
    "p = plt.plot(x, g(x), 'k-')\n",
    "p = plt.fill_between(x, g(x))\n",
    "plt.annotate(r\"$\\int_0^{\\infty}e^{-x^1/2}dx = $\" + \"{}\".format(value), (4, 0.6),\n",
    "         fontsize=16)\n",
    "print \"upper bound on error: {:.1e}\".format(max_err)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 双重积分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "假设我们要进行如下的积分：\n",
    "\n",
    "$$ I_n = \\int \\limits_0^{\\infty} \\int \\limits_1^{\\infty} \\frac{e^{-xt}}{t^n}dt dx = \\frac{1}{n}$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "def h(x, t, n):\n",
    "    \"\"\"core function, takes x, t, n\"\"\"\n",
    "    return np.exp(-x * t) / (t ** n)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "一种方式是调用两次 `quad` 函数，不过这里 `quad` 的返回值不能向量化，所以使用了修饰符 `vectorize` 将其向量化："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from numpy import vectorize\n",
    "@vectorize\n",
    "def int_h_dx(t, n):\n",
    "    \"\"\"Time integrand of h(x).\"\"\"\n",
    "    return quad(h, 0, np.inf, args=(t, n))[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "@vectorize\n",
    "def I_n(n):\n",
    "    return quad(int_h_dx, 1, np.inf, args=(n))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([ 1.97,  1.  ,  0.5 ,  0.2 ]),\n",
       " array([  9.804e-13,   1.110e-14,   5.551e-15,   2.220e-15]))"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "I_n([0.5, 1.0, 2.0, 5])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "或者直接调用 `dblquad` 函数，并将积分参数传入，传入方式有多种，后传入的先进行积分："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from scipy.integrate import dblquad\n",
    "@vectorize\n",
    "def I(n):\n",
    "    \"\"\"Same as I_n, but using the built-in dblquad\"\"\"\n",
    "    x_lower = 0\n",
    "    x_upper = np.inf\n",
    "    return dblquad(h,\n",
    "                   lambda t_lower: 1, lambda t_upper: np.inf,\n",
    "                   x_lower, x_upper, args=(n,))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([ 1.97,  1.  ,  0.5 ,  0.2 ]),\n",
       " array([  9.804e-13,   1.110e-14,   5.551e-15,   2.220e-15]))"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "I_n([0.5, 1.0, 2.0, 5])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 采样点积分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### trapz 方法 和 simps 方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from scipy.integrate import trapz, simps"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`sin` 函数， `100` 个采样点和 `5` 个采样点："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "x_s = np.linspace(0, np.pi, 5)\n",
    "y_s = np.sin(x_s)\n",
    "x = np.linspace(0, np.pi, 100)\n",
    "y = np.sin(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlYVfXa//H3VwbJEXFONCewHHFi2iioleijZc5alkpP\n46mec9kvw9JMq2OWdTyp2DH1yk6KRT5qZWIqVGqS5aygR0RFHFLxoCDz/v7+EHmMQKa9WXu4X9fl\ndfaGtdf+tDzeLO691vdWWmuEEEI4llpGBxBCCGF5UtyFEMIBSXEXQggHJMVdCCEckBR3IYRwQFLc\nhRDCAZVb3JVSK5RSF5VSh+6wzT+UUv9WSh1QSvW0bEQhhBCVVZEz95VAeFnfVEoNBTpqrX2Ap4Ao\nC2UTQghRReUWd631T8DVO2zyEPBp0bYJgKdSqrll4gkhhKgKS/TcWwGptz0/C3hbYL9CCCGqyFIf\nqKoSz2VNAyGEMJCrBfaRBrS+7bl30df+QCklBV8IIapAa13yBLpcljhz3wg8DqCUCgT+o7W+WNqG\nWmu7/fPGG28YnsFR81+6dIlZs2b94XlcXFyp2dPT0+nRowcdO3bk1VdfJTQ0lOHDh1OvXj1iYmJK\n3f/Jkyc5fPhw8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AdX4DFUhhBDWJ8VdCCEc\nkBR3IYRwQFLchRDCAUlxF0IIByTFXQghHJAUdyGEcEBS3IUQwgH9f9NqCj+GhaK3AAAAAElFTkSu\nQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xc1954e0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "p = plt.plot(x, y, 'k:')\n",
    "p = plt.plot(x_s, y_s, 'k+-')\n",
    "p = plt.fill_between(x_s, y_s, color=\"gray\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "采用 [trapezoidal 方法](https://en.wikipedia.org/wiki/Trapezoidal_rule) 和 [simpson 方法](https://en.wikipedia.org/wiki/Simpson%27s_rule) 对这些采样点进行积分（函数积分为 2）："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Trapezoidal Integration over 5 points : 1.896\n",
      "Simpson Integration over 5 points : 2.005\n",
      "Trapezoidal Integration over 100 points : 2.000\n"
     ]
    }
   ],
   "source": [
    "result_s = trapz(y_s, x_s)\n",
    "result_s_s = simps(y_s, x_s)\n",
    "result = trapz(y, x)\n",
    "print \"Trapezoidal Integration over 5 points : {:.3f}\".format(result_s)\n",
    "print \"Simpson Integration over 5 points : {:.3f}\".format(result_s_s)\n",
    "print \"Trapezoidal Integration over 100 points : {:.3f}\".format(result)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用 ufunc 进行积分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`Numpy` 中有很多 `ufunc` 对象："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "numpy.ufunc"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(np.add)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "accumulate(array, axis=0, dtype=None, out=None)\n",
      "\n",
      "Accumulate the result of applying the operator to all elements.\n",
      "\n",
      "For a one-dimensional array, accumulate produces results equivalent to::\n",
      "\n",
      "  r = np.empty(len(A))\n",
      "  t = op.identity        # op = the ufunc being applied to A's  elements\n",
      "  for i in range(len(A)):\n",
      "      t = op(t, A[i])\n",
      "      r[i] = t\n",
      "  return r\n",
      "\n",
      "For example, add.accumulate() is equivalent to np.cumsum().\n",
      "\n",
      "For a multi-dimensional array, accumulate is applied along only one\n",
      "axis (axis zero by default; see Examples below) so repeated use is\n",
      "necessary if one wants to accumulate over multiple axes.\n",
      "\n",
      "Parameters\n",
      "----------\n",
      "array : array_like\n",
      "    The array to act on.\n",
      "axis : int, optional\n",
      "    The axis along which to apply the accumulation; default is zero.\n",
      "dtype : data-type code, optional\n",
      "    The data-type used to represent the intermediate results. Defaults\n",
      "    to the data-type of the output array if such is provided, or the\n",
      "    the data-type of the input array if no output array is provided.\n",
      "out : ndarray, optional\n",
      "    A location into which the result is stored. If not provided a\n",
      "    freshly-allocated array is returned.\n",
      "\n",
      "Returns\n",
      "-------\n",
      "r : ndarray\n",
      "    The accumulated values. If `out` was supplied, `r` is a reference to\n",
      "    `out`.\n",
      "\n",
      "Examples\n",
      "--------\n",
      "1-D array examples:\n",
      "\n",
      ">>> np.add.accumulate([2, 3, 5])\n",
      "array([ 2,  5, 10])\n",
      ">>> np.multiply.accumulate([2, 3, 5])\n",
      "array([ 2,  6, 30])\n",
      "\n",
      "2-D array examples:\n",
      "\n",
      ">>> I = np.eye(2)\n",
      ">>> I\n",
      "array([[ 1.,  0.],\n",
      "       [ 0.,  1.]])\n",
      "\n",
      "Accumulate along axis 0 (rows), down columns:\n",
      "\n",
      ">>> np.add.accumulate(I, 0)\n",
      "array([[ 1.,  0.],\n",
      "       [ 1.,  1.]])\n",
      ">>> np.add.accumulate(I) # no axis specified = axis zero\n",
      "array([[ 1.,  0.],\n",
      "       [ 1.,  1.]])\n",
      "\n",
      "Accumulate along axis 1 (columns), through rows:\n",
      "\n",
      ">>> np.add.accumulate(I, 1)\n",
      "array([[ 1.,  1.],\n",
      "       [ 0.,  1.]])\n"
     ]
    }
   ],
   "source": [
    "np.info(np.add.accumulate)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`np.add.accumulate` 相当于 `cumsum` ："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "result_np = np.add.accumulate(y) * (x[1] - x[0]) - (x[1] - x[0]) / 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEACAYAAAC08h1NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XuczHX7x/HX5Uxko9JJ1F39UlTuTiLZKOfQ3VF0l3QT\nSSpRIcqhYpXSXblFUSJ0Ylch2ZwiwkaO1a7oQLLjnMP6/P74zmYas3bX2N2Znffz8ZjHfmfnMzOf\nx3fqcu31ub6fMeccIiISO4oU9ARERCR/KfCLiMQYBX4RkRijwC8iEmMU+EVEYowCv4hIjAkr8JtZ\nZTObbWbfmdlKM+uaxbhXzGy9maWYWc1w3lNERMJTLMznHwAecc4tN7OywDdmNtM5tzpzgJk1Bc5z\nzp1vZlcDrwO1wnxfERE5RmFl/M6535xzy/3Hu4DVwBlBw1oAY/xjFgFxZlYpnPcVEZFjd9xq/GZW\nFagJLAp66ExgY8D9TcBZx+t9RUQkd45L4PeXeSYDD/sz/yOGBN3XPhEiIgUk3Bo/ZlYc+AB41zn3\ncYghPwOVA+6f5f9d8OvoHwMRkVxyz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f6R+BmZ2spnF+Y9LAzcCy4KGRfK5z3b+\nuT33+Vbqcc4dNLMuwHS8xYlRzrnVZtbR//gI59w0M2tqZt8Du4F2+TW/7ORk/sCtQCczOwjsAe4s\nsAkHMbPxQD3gZDPbCPTF606K+HMP2c+fCD73fnWAtsC3Zpb5P+1TeBdARsNnkO38idzP4HRgjJkV\nwUt233HOzYqW2EMO5k8uz70u4BIRiTH66kURkRijwC8iEmMU+EVEYowCv4hIjFHgFxGJMQr8IiIx\nRoFfRCTGKPCLiMSY/weoVZxsAST89wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xc612a20>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "p = plt.plot(x, - np.cos(x) + np.cos(0), 'rx')\n",
    "p = plt.plot(x, result_np)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 速度比较"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "计算积分：$$\\int_0^x sin \\theta d\\theta$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import sympy\n",
    "from sympy.abc import x, theta\n",
    "sympy_x = x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "x = np.linspace(0, 20 * np.pi, 1e+4)\n",
    "y = np.sin(x)\n",
    "sympy_y = vectorize(lambda x: sympy.integrate(sympy.sin(theta), (theta, 0, x)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`numpy` 方法："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The slowest run took 4.32 times longer than the fastest. This could mean that an intermediate result is being cached \n",
      "10000 loops, best of 3: 56.2 µs per loop\n",
      "-2.34138044756e-17\n"
     ]
    }
   ],
   "source": [
    "%timeit np.add.accumulate(y) * (x[1] - x[0])\n",
    "y0 = np.add.accumulate(y) * (x[1] - x[0])\n",
    "print y0[-1] "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`quad` 方法："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10000 loops, best of 3: 40.5 µs per loop\n",
      "result =  3.43781337153e-15\n",
      "number of evaluations 21\n"
     ]
    }
   ],
   "source": [
    "%timeit quad(np.sin, 0, 20 * np.pi)\n",
    "y2 = quad(np.sin, 0, 20 * np.pi, full_output=True)\n",
    "print \"result = \", y2[0]\n",
    "print \"number of evaluations\", y2[-1]['neval']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`trapz` 方法："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10000 loops, best of 3: 105 µs per loop\n",
      "-4.4408920985e-16\n"
     ]
    }
   ],
   "source": [
    "%timeit trapz(y, x)\n",
    "y1 = trapz(y, x)\n",
    "print y1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`simps` 方法："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1000 loops, best of 3: 801 µs per loop\n",
      "3.28428554968e-16\n"
     ]
    }
   ],
   "source": [
    "%timeit simps(y, x)\n",
    "y3 = simps(y, x)\n",
    "print y3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`sympy` 积分方法："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "100 loops, best of 3: 6.86 ms per loop\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "%timeit sympy_y(20 * np.pi)\n",
    "y4 = sympy_y(20 * np.pi)\n",
    "print y4"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
